#!/bin/bash
function test
{
    result=su cat /etc/passwd|cut -d: -f1
    echo "$result"
}

var1=`test`
for i in $var1
do
    echo "$i"
done